#include "SpriteManager.h"


SpriteManager::SpriteManager() 
{
}

SpriteManager::~SpriteManager() 
{
}

SpriteManager* SpriteManager::m_xInstance = nullptr;

SpriteManager* SpriteManager::GetInstance()
{
	if (m_xInstance == nullptr)
	{
		m_xInstance = new SpriteManager;
	}
	return m_xInstance;
}

void SpriteManager::Destroy()
{
	if (m_xInstance != NULL)
	{
		delete m_xInstance;
		m_xInstance = NULL;
	}
}

sf::Sprite* SpriteManager::LoadSprite(std::string p_Path, int p_DrawPriority, bool p_Persistent)
{
	m_xImgLoader = ImgLoader::GetInstance();
	m_xDisplayManager = DisplayManager::GetInstance();
	m_xSprite = new sf::Sprite;
	m_xSprite->setTexture(*m_xImgLoader->loadImage(p_Path, p_Persistent));
	m_xDisplayManager->AddDrawable(m_xSprite, p_DrawPriority);
	return m_xSprite;
}